﻿using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace UFrame
{
    public class NavEditor
    {
        public const string KeyName = "Plateface/2D/Nav2D/BakePath";
        public const string ReadPath = "Plateface/2D/Nav2D/ReadPath";

        [MenuItem(ReadPath)]
        public static void ReadPath2DNav()
        {
            NavGraphMa.I.LoadScenePath();
        }


        [MenuItem(KeyName)]
        public static void BakePath2DNav()
        {
            if (Selection.objects == null)
            {
                return;
            }

            List<NavRect> list = new List<NavRect>();
            foreach (var item in Selection.objects)
            {
                GameObject go = item as GameObject;
                if (go != null)
                {
                    var r = go.GetComponent<NavRect>();
                    if (r != null)
                    {
                        list.Add(r);
                    }
                }
            }


            //开始烘培数据，两个点是否相通
            //1. 从低到高
            //2. 从高到低(包括相等)

            //覆盖情况 A坐标在坐标B宽度之内， A的宽度小于B 无法连接
            //
        }
    }
}